#include <stdio.h>
#include <string.h>

#define MAX_SIZE 100

int main(int argc, char *argv[])
{
	int n, i, j, max, idx;
	int a[MAX_SIZE], b[MAX_SIZE];

	scanf("%d", &n);

	for (i=0; i<n-1; i++) {
		scanf("%d", &a[i]);
	}

	for (i=0; i<n-2; i++) {
		b[i] = a[i+1] - a[i];
	}

	max = 0; idx = 0;
	for (i=0; i<n-2; i++) {
		if (b[i] > max) {
			max = b[i]; idx = i;
		}
	}
	a[n-2] = a[n-2] - max;

	max = 0;
	for (i=0; i<n-2; i++) {
		if (b[i] > max && i != idx && i != idx + 1 && i != idx - 1) {
			max = b[i];
		}
	}
	a[n-2] = a[n-2] - max;
	printf("%d\n", a[n-2]);

	return 0;
}
